#!/usr/bin/env python3
"""
MCP测试代码 - 基于JSON配置生成
"""

import asyncio
import sys
import os

# 添加当前目录到Python路径
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

def main():
    """MCP测试入口点"""
    try:
        # 导入服务器模块
        from system_monitor_mcp.server import main as async_main
        
        print("启动MCP服务器...")
        # 运行异步主函数
        asyncio.run(async_main())
    except KeyboardInterrupt:
        print("\n服务器已停止", file=sys.stderr)
        sys.exit(0)
    except Exception as e:
        print(f"服务器启动失败: {e}", file=sys.stderr)
        sys.exit(1)

if __name__ == "__main__":
    main()